<?php


class Solution
{

    /**
     * @param Integer $x
     * @return Integer
     */
    function reverse($x)
    {
        $y = [];
        $flag = '';
        $arrayX = str_split($x);
        foreach ($arrayX as $v) {
            if ($v == '-') {
                $flag = '-';
                continue;
            }
            $y[] = $v;
        }
        $y = array_reverse($y);
        $r = intval($flag . implode($y));
        if ($r > pow(2, 31) || $r < -pow(2, 31)) {
            $r = 0;
        }
        return $r;
    }
}

$c = new Solution();
$r = $c->reverse(1534236469);
echo $r;